# Contributor: Thomas Kienlen <kommander@laposte.net>
# Maintainer: Thomas Kienlen <kommander@laposte.net>
pkgname=spotify-tui
pkgver=0.25.0
pkgrel=0
pkgdesc="Spotify for the terminal written in Rust"
url="https://github.com/Rigellute/spotify-tui"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le" # limited by rust/cargo
license="MIT"
makedepends="rust cargo openssl-dev libxcb-dev python3"
source="$pkgname-$pkgver.tar.gz::https://github.com/Rigellute/spotify-tui/archive/v$pkgver/spotifyd-$pkgver.tar.gz"

prepare() {
	default_prepare

	# Optimize binary for size (9 MiB -> 4.4 MiB).
	cat >> Cargo.toml <<-EOF

		[profile.release]
		codegen-units = 1
		lto = true
		opt-level = "z"
		panic = "abort"
	EOF
}

build() {
	cargo build --release --locked --target-dir "target/"
}

check() {
	cargo test --locked --target-dir=target
}

package() {
	install -D -m 755 target/release/spt -t "$pkgdir"/usr/bin
}

sha512sums="
92a2ab53059b7d58e502a732f16a8eb725e19ea2e13c4f63dd64e3f0d62a3999f6b6b338c396db734f6ee9d63459da15e69b392f945c8f967d794447ac5ff8a4  spotify-tui-0.25.0.tar.gz
"
